<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="include :: header"></head>
<body>
<div style="padding: 15px">
    <form class="layui-form" action="" th:object="${dept}">
        <input name="deptId" type="hidden" th:field="*{deptId}"/>
        <input id="treeId" name="parentId" type="hidden" th:field="*{parentId}"/>
        <div class="layui-row">
            <div class="layui-col-xs12">
                <div class="layui-form-item">
                    <label class="layui-form-label">上级部门</label>
                    <div class="layui-input-inline">
                        <input class="layui-input" type="text" onclick="selectDeptTree()" id="treeName" readonly="true"
                               th:value="*{parentName}"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">部门名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="deptName" th:field="*{deptName}" lay-verify="required"
                                   autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">显示排序</label>
                        <div class="layui-input-inline">
                            <input type="text" name="orderNum" th:field="*{orderNum}" lay-verify="required"
                                   autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">负责人</label>
                        <div class="layui-input-inline">
                            <input type="text" name="leader" th:field="*{leader}" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">联系电话</label>
                        <div class="layui-input-inline">
                            <input type="phone" name="phone" th:field="*{phone}" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">邮箱</label>
                        <div class="layui-input-inline">
                            <input type="email" name="email" th:field="*{email}" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">部门状态</label>
                        <div class="layui-input-inline">
                            <select name="status" id="status" lay-verify="required" lay-search="">
                                <option value="0" th:field="*{status}">存在</option>
                                <option value="2" th:field="*{status}">删除</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="dept">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </div>
    </form>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript" th:src="@{/jquery-ztree/js/jquery.ztree.all-3.5.js}"></script>
<script th:inline="javascript">
    /*<![CDATA[*/
    var sysUrl = '/venus/system/dept';

    layui.use(['form'], function () {
        var form = layui.form;
        form.on('submit(dept)', function (data) {
            save(sysUrl, 'add', data.field);
            return false;
        });
    });

    /*]]>*/
</script>
</body>
</html>